package com.db.stockexchange.domain;

import com.db.stockexchange.domain.order.Order;
import com.db.stockexchange.domain.order.OrderStatus;
import com.db.stockexchange.network.Server.Connection;

/**
 * Basically, this is a TDO for Order.
 */
public class ExecutionReport {
	
	private int clientOrderId;
	private OrderStatus orderStatus;
	private int filledQuantity;
	private Connection connection;
	private String rejectReason;
	private String counterparty;
	
	public ExecutionReport(Order order) {
		clientOrderId = order.getClientOrderId();
		orderStatus = order.getOrderStatus();
		filledQuantity = order.getFilledQuantity();
		connection = order.getConnection();
	}
	
	public ExecutionReport(Order order, String rejectReason) {
		this(order);
		this.rejectReason = rejectReason;
	}
	
	public ExecutionReport(Order order, Order matchingOrder) {
		this(order);
		counterparty = matchingOrder.getUsername();
	}

	public String getCounterparty() {
		return counterparty;
	}

	public void setCounterparty(String username) {
		this.counterparty = username;
	}

	public String getRejectReason() {
		return rejectReason;
	}

	public int getClientOrderId() {
		return clientOrderId;
	}

	public OrderStatus getOrderStatus() {
		return orderStatus;
	}

	public int getFilledQuantity() {
		return filledQuantity;
	}

	public Connection getConnection() {
		return connection;
	}

}
